<template>
  <div>
    <el-table :data="list" style="width: 100%; padding-top: 15px">
      <el-table-column label="标题">
        <template slot-scope="scope">
          <router-link :to="'/resourcedetail/' + scope.row.id">{{ scope.row.title }}</router-link>
        </template>
      </el-table-column>
      <el-table-column label="内容" align="left">
        <template slot-scope="scope">
          {{ scope.row.content }}
        </template>
      </el-table-column>
      <el-table-column label="时间" align="center">
        <template slot-scope="{ row }">
          {{ row.date }}
        </template>
      </el-table-column>
      <el-table-column label="提供者" align="center">
        <template slot-scope="{ row }">
          {{ row.username }}
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>
<script>
import { resourcelist } from "@/api/resource";
import { toThousandFilter } from "@/core/filters";
export default {
  data() {
    return {
      list: null,
    };
  },
  created() {
    this.fetchData();
  },
  filters: {},
  methods: {
    fetchData() {
      resourcelist().then((response) => {
        this.list = response.data.items.slice(0, 8);
      });
    },
  },
};
</script>
<style scoped>
</style>